home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 016a / love4th.zip / CPU80X86.DOC < prev    next >
Text File  |  1991-10-01  |  2KB  |  48 lines

  1. 8086/8 Register Usage
  2. =====================
  3.         The register usage is summarised as follows:
  4.  
  5.         SI - Forth interpretive pointer (IP)
  6.         SP - Parameter stack    }  sometimes these pointers are
  7.         BP - Return stack       }           exchanged
  8.  
  9.         CS - Points to code segment CS:
  10.         DS - Points to thread segment TS:
  11.         SS - Points to stack segment SS:
  12.         ES - Points to variable segment VS:
  13.  
  14.         DI - reserved for use as local variable stack pointer
  15.  
  16.         On entry to a word:
  17.  
  18.         BX - points to the compilation address of the word being 
  19.                      executed
  20.         AX - is destroyed between words
  21.         CX, DX - may be used as scratch registers
  22.  
  23. Kernel examples of register usage
  24. =================================
  25.  
  26. CODE LIT     ( -- N )
  27.       WORD LODS   AX PUSH   NEXT-JMP C;
  28.  
  29. ( LODS  always loads relative to DS = TS: )
  30. ( PUSH  stores relative to SS )
  31. ( all code executes relative to CS )
  32.  
  33. CODE @
  34.      BX POP   ES: [BX] PUSH   NEXT-JMP C;
  35. ( POP   always loads relative to SS )
  36. ( [BX]  must be overridden to fetch from ES: )
  37. (   PUSH always relative to SS)
  38.  
  39. CODE FILL            ( addr, count, value -- )
  40.     DX, DI MOV                             ( save value of DI )
  41.     AX POP    CX POP    DI POP             ( get parameters)
  42.     AH, AL MOV  CX, 1 SHR                  ( odd number of bytes ?)
  43.     IFU< BYTE STOS ( odd # bytes )  THEN   ( store odd one)
  44.     REP WORD STOS                          ( store the remainder)
  45.     DI, DX MOV NEXT-JMP C;                 ( restore DI)
  46.  
  47. ( POP   always loads relative to SS )
  48. ( STOS  always stores relative to ES  = VS: )